package cc.ufinity.networkdiagnose.view;

import cc.ufinity.networkdiagnose.manager.MessageWhat;
import cc.ufinity.networkdiagnose.widget.TaskWidget;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;

public class TaskActivity extends AbstractActivity {
	
	private TaskWidget tw;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		tw = new TaskWidget(this);
		this.setContentView(tw);
		tw.start();
	}

	@Override
	protected void onResume() {
		int value = this.getIntent()
				.getIntExtra(MessageWhat.INDEX_FLAG_NAME, 0);
		if (value == MessageWhat.INDEX_FLAG_VALUE) {
		    tw = new TaskWidget(this);
		    this.setContentView(tw);
		    tw.start();
		}
		super.onResume();
		
	}
	
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (KeyEvent.KEYCODE_BACK == keyCode) {
			Log.d("返回 任务测试", "返回按钮");
			tw = new TaskWidget(this);
		    this.setContentView(tw);
		    tw.start();
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}

}